home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: July 9, 1997
- // Author: sw
- //
- // Procedure Name:
- // AEavgNurbsSurfacePointsTemplate
- //
- // Description Name;
- // Creates the attribute editor controls for the
- // avgNurbsSurfacePoints Node
- //
- // Input Value:
- // nodeName
- //
- // Output Value:
- // None
- //
-
- global proc AEavgNurbsSurfacePointsTemplate ( string $nodeName )
- {
- editorTemplate -beginScrollLayout;
-
- editorTemplate -beginLayout "Average NURBS Surface Points History" -collapse false;
- editorTemplate -callCustom
- "AEsurfacePointNew"
- "AEsurfacePointReplace"
- "surfacePoint";
- editorTemplate -endLayout;
-
- // suppressed attributes
- editorTemplate -suppress "inputSurface";
- editorTemplate -suppress "surfacePoint";
-
- // include/call base class/node attributes
- AEdependNodeTemplate $nodeName;
-
- editorTemplate -addExtraControls;
- editorTemplate -endScrollLayout;
- }
-
-
- proc AEconnectSurfacePointControls( string $plug, string $srfPt )
- {
-
- string $number[];
- tokenize($srfPt, "[]", $number);
- string $name = ($number[0] + $number[1]);
-
- // get the index
- //
- string $buffer[];
- tokenize($srfPt,"[]",$buffer);
- string $index = $buffer[1];
-
- // get the nodeName
- //
- clear $buffer;
- tokenize($plug,".",$buffer);
- string $nodeName = $buffer[0];
-
- // build the plug name
- //
- string $plugName = $nodeName+"."+$srfPt;
-
- // get the input node
- //
- string $inputAttr = ($plugName+".inputSurface");
- string $inputNode[] = `listConnections -d false -sh true $inputAttr`;
-
- text -e -l ("Surface Point["+$index+"]") srfPtLabel;
- textField -e -tx $inputNode[0] srfPtInput;
- connectControl ($name + "Weight") ($plugName+".weight");
- connectControl ($name + "Floats") -index 2 ($plugName+".parameterU");
- connectControl ($name + "Floats") -index 3 ($plugName+".parameterV");
- connectControl ($name + "Ints") -index 2 ($plugName+".cvIthIndex");
- connectControl ($name + "Ints") -index 3 ($plugName+".cvJthIndex");
- }
-
-
- proc AEcreateNewSurfacePointControls( string $nodeName, string $srfPt )
- {
- string $number[];
- tokenize($srfPt, "[]", $number);
- string $name = ($number[0] + $number[1]);
-
- string $inputAttr = ($nodeName+"."+$srfPt+".inputSurface");
- string $connections[] = `listConnections -p true $inputAttr`;
- string $conInput[];
- tokenize($connections[0], ".", $conInput);
-
- setUITemplate -pst attributeEditorTemplate;
- columnLayout -adj true;
- separator ($name + "Sep");
- rowLayout -nc 4;
- text srfPtLabel;
- textField -ed false srfPtInput;
- if ($conInput[0] == ""){
- symbolButton -i "inArrow.xpm" -en 0
- goToConnectedInput;
- } else {
- symbolButton -i "inArrow.xpm"
- -c ("AEgoToConnected " + $conInput[0] )
- goToConnectedInput;
- }
- setParent ..;
- floatSliderGrp -f 1 -min 0 -max 1 -l "Weight" ($name + "Weight");
- floatFieldGrp -nf 2 -l "Parameters UV" ( $name + "Floats");
- intFieldGrp -nf 2 -l "Index IJ" ($name + "Ints");
- setParent ..;
-
- AEconnectSurfacePointControls( $nodeName, $srfPt );
- setUITemplate -ppt;
- }
-
-
- global proc AEsurfacePointNew( string $plug )
- {
-
- // get the nodeName
- //
- string $buffer[];
- tokenize($plug,".",$buffer);
- string $nodeName = $buffer[0];
-
- // get all of the elements of the array
- //
- string $tmpPoints[] = `listAttr -m $plug`;
- string $surfacePoints[];
- for ($tmp in $tmpPoints) {
- string $tmpBuffer[];
- tokenize($tmp,".",$tmpBuffer);
- if (size($tmpBuffer) == 1) {
- $surfacePoints[size($surfacePoints)] = $tmp;
- }
- }
- int $numSurfacePoints = size($surfacePoints);
-
- setUITemplate -pst attributeEditorTemplate;
- columnLayout AEsurfacePointLayout;
- for ( $srfPt in $surfacePoints ) {
- AEcreateNewSurfacePointControls($nodeName, $srfPt);
- }
- setParent ..;
- setUITemplate -ppt;
-
- }
-
-
- global proc AEsurfacePointReplace( string $plug )
- {
- // get the nodeName
- //
- string $buffer[];
- tokenize($plug,".",$buffer);
- string $nodeName = $buffer[0];
-
- string $tmpPoints[] = `listAttr -m $plug`;
- string $newSurfacePoints[];
- for ($tmp in $tmpPoints) {
- string $tmpBuffer[];
- tokenize($tmp,".",$tmpBuffer);
- if (size($tmpBuffer) == 1) {
- $newSurfacePoints[size($newSurfacePoints)] = $tmp;
- }
- }
- int $newNumSurfacePoints = size ($newSurfacePoints);
- string $oldSurfacePointLayouts[] = `columnLayout -q -ca AEsurfacePointLayout`;
- int $oldNumSurfacePoints = size ($oldSurfacePointLayouts);
-
- setParent AEsurfacePointLayout;
-
- if ( $newNumSurfacePoints >= $oldNumSurfacePoints ) {
-
- // replace what we can
- //
- for ( $i = 0; $i < $oldNumSurfacePoints; $i++ ) {
- setParent $oldSurfacePointLayouts[$i];
- AEconnectSurfacePointControls($nodeName, $newSurfacePoints[$i]);
- }
-
- // and build what we need
- //
- setParent AEsurfacePointLayout;
- for ( $i = $oldNumSurfacePoints; $i < $newNumSurfacePoints; $i++ ) {
- AEcreateNewSurfacePointControls($nodeName, $newSurfacePoints[$i]);
- }
-
-
- } else {
-
- // replace what we need
- //
- for ( $i = 0; $i < $newNumSurfacePoints; $i++ ) {
- setParent $oldSurfacePointLayouts[$i];
- AEconnectSurfacePointControls($nodeName, $newSurfacePoints[$i]);
- }
-
- // delete old columnLayouts
- //
- setParent AEsurfacePointLayout;
- for ( $i = $newNumSurfacePoints; $i < $oldNumSurfacePoints; $i++ ) {
- deleteUI -layout $oldSurfacePointLayouts[$i];
- }
-
- }
- }
-